<script setup lang="ts">
import { inject } from 'vue';
import SonSon from './SonSon.vue';

interface peron{
  name:string,
  age:number
}
defineProps<peron>()
const emits=defineEmits<{(e:'my-event',age:number):void}>()

// const emutss=defineEmits<{
//   'getName':[name:string]
// }>()
const totalCount=inject<number>('totalCount')
</script>


<template>
  <div class="son">
  <p>子组件</p>
  <div>{{name}}</div>
  <div>{{age}}</div>
  <p>提供的数据：{{ totalCount }}</p>
  <button @click="emits('my-event',age)">点击触发回调函数</button>
  <!-- <button @click="emutss('getName',name)">点击触发回调函数2</button> -->
   <SonSon/>
</div>
</template>


<style scoped>
.son{
  border: 1px solid red;
}
</style>